/*
 * Ext GWT - Ext for GWT
 * Copyright(c) 2007-2009, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://extjs.com/license
 */
package com.google.code.teamtools.client.view;

import com.extjs.gxt.ui.client.Registry;
import com.extjs.gxt.ui.client.mvc.AppEvent;
import com.extjs.gxt.ui.client.mvc.Controller;
import com.extjs.gxt.ui.client.mvc.View;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.google.code.teamtools.client.AppEvents;
import com.google.code.teamtools.client.widget.TaskPanel;

public class TaskView extends View
{
    private TaskPanel panel;

    public TaskView(Controller controller)
    {
        super(controller);
    }

    @Override
    protected void initialize()
    {
        panel = new TaskPanel();
    }

    @Override
    protected void handleEvent(AppEvent event)
    {
        if (event.getType() == AppEvents.NavTasks) {
            LayoutContainer wrapper = (LayoutContainer) Registry.get(AppView.CENTER_PANEL);
            wrapper.removeAll();
            wrapper.add(panel);
            wrapper.layout();
        }
    }
}
